package com.tuanzi.loan.business.service.settlementsystem.impl;

import com.tuanzi.loan.business.entity.settlementsystem.SettlementIncomeActivity;
import com.tuanzi.loan.business.repository.settlementsystem.SettlementIncomeActivityRepository;
import com.tuanzi.loan.business.service.settlementsystem.SettlementIncomeActivityService;
import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.core.service.CommonServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.retry.RetryException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

/**
 * @author caiwanlin
 * @create 2018-08-20 20:28
 */
@Debug
@Service
@Transactional
@Retryable(value = {RetryException.class})
public class SettlementIncomeActivityServiceImpl extends CommonServiceImpl<SettlementIncomeActivity,Long> implements SettlementIncomeActivityService {
    @Autowired
    private SettlementIncomeActivityRepository settlementIncomeActivityRepository;
    @Override
    protected JpaRepository<SettlementIncomeActivity, Long> getRepository() {
        return settlementIncomeActivityRepository;
    }

    @Override
    public List<SettlementIncomeActivity> findAllByIncomeId(Long incomeId) {
        return settlementIncomeActivityRepository.findAllByIncomeId(incomeId);
    }

    @Override
    public Integer getUv(Date startTime, Date endTime, List<Long> activityIdList) {
        return settlementIncomeActivityRepository.getUv(startTime,endTime,activityIdList);
    }
}
